<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
   
    <ui:composition template="/views/_template.xhtml">
    	<ui:define name="corpo">
            <h:messages style=" color: #C22;" />
            <div>
                <h:outputLabel value="Dados do cliente juridico" style="border-bottom: 3px solid #C22; text-align: left; font-size: 18px; width: 900px;" 
                               rendered="#{empty clientePFBean.clientePF.id}" />
                <h:outputLabel value="Alterar Dados do cliente juridico" style="border-bottom: 3px solid #C22; text-align: left; font-size: 18px; width: 900px;" 
                               rendered="#{not empty clientePFBean.clientePF.id}" /> 
            </div>
            <h:form>
                <p:messages id="mensagens" showDetail="true" />
                <h:dataTable styleClass="dadosForm" style="border: 1px solid #E4E4E4">
                    <h:column>
                    <f:facet name="header">
                        <h:outputLabel style="margin: 5px; text-align: left" for="nomeConta" value="Nome do cliente" />
                    </f:facet>
                    <f:facet name="footer">
                        <h:outputLabel style="color: #C22" value="*" />
                        <p:inputText id="nomeConta" style="width: 450px;" value="#{clientePFBean.clientePF.nome}" required="true" 
                                     requiredMessage="Campo nome é obrigatorio!" />
                    </f:facet>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputLabel style="margin: 5px;text-align: left;" value="CPF" />
                        </f:facet>
                        <f:facet name="footer" >
                            <h:outputLabel style="color: #C22" value="*" />
                            <p:inputMask mask="999.999.999-99" value="#{clientePFBean.clientePF.cpf}"  required="true"
                                         requiredMessage="Campo CPF é obrigatorio!" />
                        </f:facet>
                    </h:column>

                    <h:column>
                        <f:facet name="header">  
                            <h:outputLabel style="margin: 5px; text-align: left; width: 150px;" for="de" value="Cliente desde:" />
                            <f:facet name="footer">
                                <p:calendar id="de" pattern="dd/MM/yyyy" value="#{clientePFBean.clientePF.clienteDesde}" />
                            </f:facet>
                        </f:facet>
                    </h:column>

                </h:dataTable>

                <h:dataTable styleClass="dadosForm" style="border: 1px solid #E4E4E4">
                    <h:column>
                        <f:facet name="header">
                            <h:outputLabel style="margin: 5px; text-align: left"  value="Atividade principal" for="nConta" />
                        </f:facet>
                        <f:facet name="footer">
                            <p:inputText id="nConta" style="width: 127px;" value="#{clientePFBean.clientePF.identidade}" />
                        </f:facet>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputLabel style="margin: 5px; text-align: left;" value="Data de nascimento" />
                        </f:facet>
                        <f:facet name="footer">
                            <p:calendar pattern="dd/MM/yyyy" value="#{clientePFBean.clientePF.dataNascimento.time}" />
                        </f:facet>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputLabel style="margin: 5px; text-align: left;" value="Estado civil" />
                        </f:facet>
                        <f:facet name="footer">
                            <p:selectOneMenu value="#{clientePFBean.clientePF.estadoCivil}" >
                                <f:selectItem itemLabel="Selecione um estado civil" itemValue="" noSelectionOption="true" />
                                <f:selectItems value="#{clientePFBean.listaEstadoCivil}" var="lista" itemLabel="#{lista.estadoCivil}" />
                            </p:selectOneMenu>
                        </f:facet>
                    </h:column>
                    
                </h:dataTable>

                <br />
                <h:commandButton value="Gravar" action="#{clientePFBean.gravar()}" />
                <h:commandButton value="Limpar" action="clientePF" />
            </h:form>
        </ui:define>
    </ui:composition>
</html>
